home *** CD-ROM | disk | FTP | other *** search
- /* Fill the buffer with file names */
-
- #include <dos/dosasl.h>
-
- #ifndef __GNUC__
- #include <pragmas/dos_pragmas.h>
- #include <clib/dos_protos.h>
- #else
- #include <inline/dos.h>
- #endif
-
- #include <stdio.h>
- #include <stdlib.h>
-
- #define MAXFILES 500
-
- extern char *PicArray[];
- extern int NumPictures;
-
-
- void FillNameBuffer(char *pattern)
- {
- int i;
- LONG error;
- struct AnchorPath *MyAnchorPath;
-
- MyAnchorPath = calloc(sizeof(struct AnchorPath)+256, 1);
-
- if(MyAnchorPath == NULL)
- {
- printf("Out of memory!\n");
- exit(10);
- }
-
- MyAnchorPath->ap_Strlen = 254;
-
- error = MatchFirst(pattern, MyAnchorPath);
- if(error) return;
-
- while(!error)
- {
- PicArray[NumPictures] = malloc(strlen((char *)&MyAnchorPath->ap_Buf)+1);
- if(!PicArray[NumPictures])
- {
- printf("Out of memory!\n");
- MatchEnd(MyAnchorPath);
- exit(10);
- }
- strcpy(PicArray[NumPictures], MyAnchorPath->ap_Buf);
- /* puts(PicArray[NumPictures]); */
- NumPictures++;
- if(NumPictures == MAXFILES)
- {
- printf("Too many files!\n");
- MatchEnd(MyAnchorPath);
- return;
- }
- error = MatchNext(MyAnchorPath);
- }
-
- MatchEnd(MyAnchorPath);
- if(MyAnchorPath) free(MyAnchorPath);
- }
-